package edu.nf.exam.dao.impl;

import edu.nf.exam.dao.ErrorQuestionInfoDao;
import edu.nf.exam.entity.ErrorQuestionInfo;
import edu.nf.exam.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @Author : QYM
 * @create 2021/6/17
 * 错题信息表--接口实现类
 */
public class ErrorQuestionInfoDaoImpl implements ErrorQuestionInfoDao {
    /**
     * 添加
     * @param errorQuestionInfo
     * @return
     */
    @Override
    public int add(ErrorQuestionInfo errorQuestionInfo) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession(true);
        int r = sqlSession.getMapper(ErrorQuestionInfoDao.class).add(errorQuestionInfo);
        sqlSession.close();
        return r;
    }

    /**
     * 查询
     * @param errorQuestionInfo
     * @return
     */
    @Override
    public List<ErrorQuestionInfo> select(ErrorQuestionInfo errorQuestionInfo) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession(true);
        List<ErrorQuestionInfo> list = sqlSession.getMapper(ErrorQuestionInfoDao.class).select(errorQuestionInfo);
        sqlSession.close();
        return list;
    }
}
